import { defineStore } from 'pinia';

export const useThemeConfig = defineStore('themeConfig', {
  persist: {
    enabled: true,
  },
  state: () => ({
    themeConfig: {
      primary: 'dark',
      globalI18n: 'zh-cn',
    }
  }),
  actions: {
    setGlobalI18n(type: string) {
      if (type) {
        this.themeConfig.globalI18n = type
      }
    },
    setPrimary(type: string) {
      if(type) {
        if(type === this.themeConfig.primary) return
        this.themeConfig.primary = type
      }
    }
  }
})